import { reactive } from 'vue';  
import { loginStore } from '@/stores/index.ts'
import {login} from "@/api/Login/index.ts"

export default function(){

    const state= loginStore();
    console.log(state);
    
    const loginForm = reactive({  
      username: '',  
      password: ''  
    });  
  
    const handleLogin = () => {  
      // 在这里添加登录逻辑，比如API调用  
      console.log('登录', loginForm); 
      login(loginForm).then(res=>{
        console.log(res);
        state.SETTOKEN("反反复复");
      });
      // const {data}=useFetch("/api/user/login",{method:"get",params:loginForm});
      // console.log(data);
      
    };  
  
    return {  
      loginForm,  
      handleLogin  
    };  


}